import { Str分析器, topic_resolve} from "../解析器";


/**
 * 目标样式:
 * 1.topic ...
 * ...
 * A.xxx B.xxx ...
 * 1.resolve ...
 * 即 题目与解析 分离, 根据序号来判断 题目与序号的连系
 */
export const Str分析器_单选题_1 : Str分析器 = {
	try_analizy(s: string): topic_resolve {
		// todo 为什么要分析一个呢...
		// todo 为什么不直接用 CV大法呢
		return {
			topic:"",
			resolve:""
		};
	},
	try_analizys(s: string): topic_resolve[] {
		let a = s.replace(/\n(\d+)\s*\./g
			,"\n~~end~~\n\n~~start~~$1\n");
		a += "\n~~end~~\n";
		let b = <RegExpMatchArray>a.match(/\n~~start~~(\d)*\n(.*\n)*?~~end~~/g);
		// console.log(b);
		console.log("题目数量(总数量/2) ; 总数量: "+b.length)
		let 题目arr :any = {};
		let sss :topic_resolve[] = [];
		for (let v in b){
			/\n~~start~~(\d*)\n((.*\n)*)~~end~~/.test(b[v]);
			if(题目arr[RegExp.$1] == null
				|| 题目arr[RegExp.$1] == undefined  ){
				let id = RegExp.$1;
				let s = RegExp.$2;
				题目arr[id] = {
					id:id,
					topic:id +'.'+ s,
					resolve:""
				};
			}else {
				题目arr[RegExp.$1].resolve = RegExp.$1 + '.' + RegExp.$2;
				sss.push({
					id:题目arr[RegExp.$1].id,
					topic:题目arr[RegExp.$1].topic,
					resolve:题目arr[RegExp.$1].resolve,
				})
			}
		}
		console.log("检查是否存在解析错误:");
		console.log(sss)
		return sss;
	},
	analizys_examplen(){
		return `1.topic ...
 ...
 A.xxx B.xxx ...
 1.resolve ...
 即 题目与解析 分离, 根据序号来判断 题目与序号的连系`
	}
	
}